<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-spring4-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<!DOCTYPE html>
<html class="bg-blue">
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>AdminLTE | Data Tables</title>
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <!-- bootstrap 3.0.2 -->
    <link href="/AdminLTE/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <!-- font Awesome -->
    <link href="/AdminLTE/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
    <!-- Ionicons -->
    <link href="/AdminLTE/css/ionicons.min.css" rel="stylesheet" type="text/css" />
    <!-- DATA TABLES -->
    <link href="/AdminLTE/css/datatables/dataTables.bootstrap.css" rel="stylesheet" type="text/css" />
    <!-- Theme style -->
    <link href="/AdminLTE/css/AdminLTE.css" rel="stylesheet" type="text/css" />

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
    <![endif]-->

    <style>
        .hover{
            display: none;
            position: absolute;
            top: 20%;
            left: 30%;
            width: 40%;
            height: 45%;
            border: 1px solid lightblue;
            background-color: white;
            z-index: 1002;
            overflow: auto;
        }


    </style>
</head>
<body class="skin-blue">
<!-- header logo: style can be found in header.less -->
<header class="header">
    <a href="#" class="logo" th:text="${localPort + 'AdminLTE'}">
        <!-- Add the class icon to your logo image or logo icon to add the margining -->
        AdminLTE
    </a>
    <!-- Header Navbar: style can be found in header.less -->
    <nav class="navbar navbar-static-top" role="navigation">
        <!-- Sidebar toggle button-->
        <a href="#" class="navbar-btn sidebar-toggle" data-toggle="offcanvas" role="button">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </a>
        <div class="navbar-right">
            <ul class="nav navbar-nav">
                <!-- Messages: style can be found in dropdown.less-->
                <li class="dropdown messages-menu">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <i class="fa fa-envelope"></i>
                        <span class="label label-success">4</span>
                    </a>
                    <ul class="dropdown-menu">
                        <li class="header">您有4条消息</li>
                        <li>
                            <!-- inner menu: contains the actual data -->
                            <ul class="menu">
                                <li><!-- start message -->
                                    <a href="#">
                                        <div class="pull-left">
                                            <img src="/AdminLTE/img/avatar5.png" class="img-circle"
                                                 alt="User Image"/>
                                        </div>
                                        <h4>
                                            支持团队
                                            <small><i class="fa fa-clock-o"></i> 5 分钟前</small>
                                        </h4>
                                        <p>Why not buy a new awesome theme?</p>
                                    </a>
                                </li><!-- end message -->
                                <li>
                                    <a href="#">
                                        <div class="pull-left">
                                            <img src="/AdminLTE/img/avatar5.png" class="img-circle"
                                                 alt="user image"/>
                                        </div>
                                        <h4>
                                            AdminLTE 设计团队
                                            <small><i class="fa fa-clock-o"></i> 2 小时前</small>
                                        </h4>
                                        <p>Why not buy a new awesome theme?</p>
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <div class="pull-left">
                                            <img src="/AdminLTE/img/avatar5.png" class="img-circle"
                                                 alt="user image"/>
                                        </div>
                                        <h4>
                                            开发者
                                            <small><i class="fa fa-clock-o"></i> 今天</small>
                                        </h4>
                                        <p>Why not buy a new awesome theme?</p>
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <div class="pull-left">
                                            <img src="/AdminLTE/img/avatar5.png" class="img-circle"
                                                 alt="user image"/>
                                        </div>
                                        <h4>
                                            销售部门
                                            <small><i class="fa fa-clock-o"></i> 昨天</small>
                                        </h4>
                                        <p>Why not buy a new awesome theme?</p>
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <div class="pull-left">
                                            <img src="/AdminLTE/img/avatar5.png" class="img-circle"
                                                 alt="user image"/>
                                        </div>
                                        <h4>
                                            Reviewers
                                            <small><i class="fa fa-clock-o"></i> 2 天前</small>
                                        </h4>
                                        <p>Why not buy a new awesome theme?</p>
                                    </a>
                                </li>
                            </ul>
                        </li>
                        <li class="footer"><a href="#">查看所有消息</a></li>
                    </ul>
                </li>
                <!-- Notifications: style can be found in dropdown.less -->
                <li class="dropdown notifications-menu">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <i class="fa fa-warning"></i>
                        <span class="label label-warning">10</span>
                    </a>
                    <ul class="dropdown-menu">
                        <li class="header">您有10条通知</li>
                        <li>
                            <!-- inner menu: contains the actual data -->
                            <ul class="menu">
                                <li>
                                    <a href="#">
                                        <i class="ion ion-ios7-people info"></i> 今天有5个新成员加入
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <i class="fa fa-warning danger"></i> Very long description here that may not fit into the page and may cause design problems
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <i class="fa fa-users warning"></i> 5 new members joined
                                    </a>
                                </li>

                                <li>
                                    <a href="#">
                                        <i class="ion ion-ios7-cart success"></i> 25 sales made
                                    </a>
                                </li>
                                <li>
                                    <a href="#">
                                        <i class="ion ion-ios7-person danger"></i> 您修改了您的名字
                                    </a>
                                </li>
                            </ul>
                        </li>
                        <li class="footer"><a href="#">查看所有通知</a></li>
                    </ul>
                </li>
                <!-- Tasks: style can be found in dropdown.less -->
                <li class="dropdown tasks-menu">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <i class="fa fa-tasks"></i>
                        <span class="label label-danger">9</span>
                    </a>
                    <ul class="dropdown-menu">
                        <li class="header">您有9条任务</li>
                        <li>
                            <!-- inner menu: contains the actual data -->
                            <ul class="menu">
                                <li><!-- Task item -->
                                    <a href="#">
                                        <h3>
                                            设计按钮
                                            <small class="pull-right">20%</small>
                                        </h3>
                                        <div class="progress xs">
                                            <div class="progress-bar progress-bar-aqua" style="width: 20%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
                                                <span class="sr-only">20% 已完成</span>
                                            </div>
                                        </div>
                                    </a>
                                </li><!-- end task item -->
                                <li><!-- Task item -->
                                    <a href="#">
                                        <h3>
                                            新建一个漂亮的主题
                                            <small class="pull-right">40%</small>
                                        </h3>
                                        <div class="progress xs">
                                            <div class="progress-bar progress-bar-green" style="width: 40%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
                                                <span class="sr-only">40% 已完成</span>
                                            </div>
                                        </div>
                                    </a>
                                </li><!-- end task item -->
                                <li><!-- Task item -->
                                    <a href="#">
                                        <h3>
                                            一些该做的任务
                                            <small class="pull-right">60%</small>
                                        </h3>
                                        <div class="progress xs">
                                            <div class="progress-bar progress-bar-red" style="width: 60%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
                                                <span class="sr-only">60% 已完成</span>
                                            </div>
                                        </div>
                                    </a>
                                </li><!-- end task item -->
                                <li><!-- Task item -->
                                    <a href="#">
                                        <h3>
                                            标准的翻译主题
                                            <small class="pull-right">80%</small>
                                        </h3>
                                        <div class="progress xs">
                                            <div class="progress-bar progress-bar-yellow" style="width: 80%" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100">
                                                <span class="sr-only">80% 已完成</span>
                                            </div>
                                        </div>
                                    </a>
                                </li><!-- end task item -->
                            </ul>
                        </li>
                        <li class="footer">
                            <a href="#">查看所有任务</a>
                        </li>
                    </ul>
                </li>
                <!-- User Account: style can be found in dropdown.less -->
                <li class="dropdown user user-menu">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                        <i class="glyphicon glyphicon-user"></i>
                        <span>Admin Lte <i class="caret"></i></span>
                    </a>
                    <ul class="dropdown-menu">
                        <!-- User image -->
                        <li class="user-header bg-light-blue">
                            <img src="/AdminLTE/img/avatar5.png" class="img-circle" alt="User Image" />
                            <p>
                                Admin Lte - 超级管理员
                                <small>注册日期：2014-09-17</small>
                            </p>
                        </li>
                        <!-- Menu Body -->
                        <li class="user-body">
                            <div class="col-xs-4 text-center">
                                <a href="#">粉丝</a>
                            </div>
                            <div class="col-xs-4 text-center">
                                <a href="#">关注</a>
                            </div>
                            <div class="col-xs-4 text-center">
                                <a href="#">好友</a>
                            </div>
                        </li>
                        <!-- Menu Footer-->
                        <li class="user-footer">
                            <div class="pull-left">
                                <a href="#" class="btn btn-default btn-flat">个人资料</a>
                            </div>
                            <div class="pull-right">
                                <a href="/admin/loginout" class="btn btn-default btn-flat">注销登录</a>
                            </div>
                        </li>
                    </ul>
                </li>
            </ul>
        </div>
    </nav>
</header>
<div class="wrapper row-offcanvas row-offcanvas-left">
    <!-- Left side column. contains the logo and sidebar -->
    <aside class="left-side sidebar-offcanvas">
        <!-- sidebar: style can be found in sidebar.less -->
        <section class="sidebar">
            <!-- Sidebar user panel -->
            <div class="user-panel">
                <div class="pull-left image">
                    <img src="/AdminLTE/img/avatar5.png" class="img-circle" alt="User Image" />
                </div>
                <div class="pull-left info">
                    <p>你好, Admin</p>

                    <a href="#"><i class="fa fa-circle text-success"></i> 在线</a>
                </div>
            </div>
            <!-- sidebar menu: : style can be found in sidebar.less -->
            <ul class="sidebar-menu">
                <li class="active">
                    <a href="#">
                        <i class="fa fa-dashboard"></i> <span>账户信息</span>
                    </a>
                </li>
            </ul>
        </section>
        <!-- /.sidebar -->
    </aside>

    <!-- Right side column. Contains the navbar and content of the page -->
    <aside class="right-side">
        <!-- Content Header (Page header) -->
        <section class="content-header">
            <h1>
                账户信息
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
                <li><a href="#">账户信息</a></li>
                <li class="active"> 账户列表</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <div class="box">
                        <div class="box-header">
                            <h3 class="box-title">账户列表</h3>
                        </div><!-- /.box-header -->
                        <button class="btn btn-success add" style="float:right;margin-right:20px">新增</button>
                        <div class="box-body table-responsive">
                            <table id="example1" class="table table-bordered table-striped">
                                <thead>
                                <tr>
                                    <th>姓名</th>
                                    <th>城市</th>
                                    <th>手机号</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                    <tr th:each="account : ${accountList}">
                                        <input type="hidden" class="minimal" th:value="${account.id}" />
                                        <td class="name"><span  th:text="${account.name}"/></td>
                                        <td class="address"><span  th:text="${account.address}"/></td>
                                        <td class="phone"><span  th:text="${account.phone}"/></td>
                                        <td>
                                            &nbsp<button class="btn btn-primary btn-sm edit">编辑</button>
                                            &nbsp<button class="btn btn-danger btn-sm delete">删除</button>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div><!-- /.box-body -->
                    </div><!-- /.box -->
                </div>
            </div>
            <!-- 弹窗 -->
            <div class="col-md-6 hover" >
                <button class="btn btn-default btn-sm hover-close" data-widget="remove" data-toggle="tooltip"
                        title="Remove"
                        style="float: right;margin-top: 10px"><i class="fa fa-times"></i></button>
                <div class="box-header">
                    <h3 class="box-title hover-title"></h3>

                </div><!-- /.box-header -->
                <!-- form start -->

                <div class="box-body">
                    <input type="hidden" class="form-control" id="id" value="0">
                    <div class="form-group">
                        <label for="name">姓名</label>
                        <input type="text" class="form-control" id="name" placeholder="用户名">
                    </div>
                    <div class="form-group">
                        <label for="address">城市</label>
                        <input type="text" class="form-control" id="address" placeholder="城市">
                    </div>
                    <div class="form-group">
                        <label for="phone">手机号</label>
                        <input type="text" class="form-control" id="phone" placeholder="手机号">
                    </div>
                </div><!-- /.box-body -->

                <div class="box-footer hover-submit" style="float: right">
                    <button type="submit" class="btn btn-primary">提交</button>
                </div>

            </div>


        </section><!-- /.content -->
    </aside><!-- /.right-side -->
</div><!-- ./wrapper -->


<!-- jQuery 2.0.2 -->
<script src="/AdminLTE/js/jquery-2.1.1.min.js"></script>
<!-- Bootstrap -->
<script src="/AdminLTE/js/bootstrap.min.js" type="text/javascript"></script>
<!-- DATA TABES SCRIPT -->
<script src="/AdminLTE/js/plugins/datatables/jquery.dataTables.js" type="text/javascript"></script>
<script src="/AdminLTE/js/plugins/datatables/dataTables.bootstrap.js" type="text/javascript"></script>
<!-- AdminLTE App -->
<script src="/AdminLTE/js/AdminLTE/app.js" type="text/javascript"></script>



<!-- page script -->
<script type="text/javascript">
    $(function() {
        $('#example1').dataTable({
            "bPaginate": true,
            "bLengthChange": false,
            "bFilter": false,
            "bSort": false,
            "bInfo": true,
            "bAutoWidth": false,
        });
    });




    // 悬浮窗元素
    var _hover = $(".hover");

    // 添加按钮
    $(".add").click(function(){
        // 弹出悬浮窗
        if (_hover.css("display") == "none") {
            _hover.show();
        }
        $(".hover-title").html("新增账户");
    });
    // 编辑按钮
    $(".edit").click(function(){
        // 自动赋值
        var _currentTr = $(this).parent().parent();
        $("#id").val(_currentTr.find("[type='hidden']").val());
        $("#name").val(_currentTr.find(".name span").html());
        $("#address").val(_currentTr.find(".address span").html());
        $("#phone").val(_currentTr.find(".phone span").html());
        // 弹出悬浮窗
        if (_hover.css("display") == "none") {
            _hover.show();
        }
        $(".hover-title").html("编辑账户");
    });

    $(".delete").click(function (){
        var msg = "您真的确定要删除吗？\n\n请确认！";
        if (confirm(msg)==true){
            var _currentTr = $(this).parent().parent();
            _id = _currentTr.find("[type='hidden']").val();
            console.log(_id);
            $.ajax({
                //提交方式使用get
                type:'DELETE',
                //提交网址
                url:'/admin/resume/'+_id,
                //数据格式
                //  dataType:'json',
                //  contentType: "application/json; charset=utf-8",
                //具体数据

                //通信成功，打印服务器返回的数据
                success:function(result){
                    if (result.success) {
                        // 关闭悬浮窗
                        hover_close();
                        alert(result.message);
                        window.location.reload();
                    } else {
                        alert(result.message);
                    }
                }
            });

        }
    })


    // 悬浮窗关闭
    $(".hover-close").click(function () {
        hover_close();
    })

    // 关闭悬浮窗，清空数据
    function hover_close(){
        _hover.hide();
        $(".hover-title").html("");
        $(".hover input[type='hidden']").each(function () {
            this.value = 0;
        })
        $(".hover input[type='text']").each(function () {
            this.value = "";
        })
    }




    $(".hover-submit").click(function () {
        var _id = $("#id").val();
        var _name = $("#name").val();
        var _address = $("#address").val();
        var _phone = $("#phone").val();
        //用异步的形式来提交数据给服务器
        $.ajax({
            //提交方式使用get
            type:'POST',
            //提交网址
            url:'/admin/resume',
            //数据格式
            //  dataType:'json',
            //  contentType: "application/json; charset=utf-8",
            //具体数据
            data:{'id':_id,name:_name,address:_address,phone:_phone},
            //通信成功，打印服务器返回的数据
            success:function(result){
                if (result.success) {
                    // 关闭悬浮窗
                    hover_close();
                    alert(result.message);
                    window.location.reload();
                } else {
                    alert(result.message);
                }
            },
            fail:function(result){
                alert(result.message);
            }
        });
    })



</script>

</body>
</html>